package com.lemonsun.service.impl;

import com.lemonsun.dao.CustomerDao;
import com.lemonsun.pojo.Reply;
import com.lemonsun.pojo.Topic;
import com.lemonsun.service.TopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/*
*业务层
 */
 @Service
 @Transactional
public class TopicServiceImpl implements TopicService {

    //注解注入CustomerDao
    @Autowired
    private CustomerDao customerDao;

    //查询所有帖子信息
    @Override
    public List <Topic> topicListService() {
        //调用dao
        return customerDao.topicListService();
    }

    //发表帖子
    @Override
    public int addTopicInf(Topic topic) {
        return customerDao.addTopicInf(topic);
    }


    //查看某个帖子信息
    @Override
    public Topic findAllTopicbyId(Integer id) {
        return customerDao.findAllTopicbyId(id);
    }


   //点击量
    @Override
    public int add_click_amount_byId(Integer id) {
        return customerDao.add_click_amount_byId(id);
    }

    //查看某个帖子评论信息
    @Override
    public  List<Topic> findAllReplyId(Integer id) {
        return customerDao.findAllReplyId(id);
    }

    //添加评论
    @Override
    public int addReplyInf(Reply reply) {
        return customerDao.addReplyInf(reply);
    }

}
